package com.yunji.app.cabinet;

import com.yunji.aggregate.model.dto.container.CabinetTemplateParams;
import com.yunji.aggregate.model.vo.container.CabinetTemplateVO;
import com.yunji.aggregate.service.ContainerAggregateService;
import com.yunji.cabinet.business.CabinetTemplateBusiness;
import com.yunji.cabinet.cache.CabinetCache;
import com.yunji.cabinet.vo.TemplateVO;
import com.yunji.common.base.BaseController;
import com.yunji.common.base.response.Response;
import com.yunji.common.base.response.ResponseHelper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * @Project: yunji-coffee
 * @Package com.yunji.web.cabinet
 * @FileName GateWayCabinetTemplateController.java
 * @Copyright Copyright © 2024 云集互联. All Rights Reserved
 * @Company com
 * @Version 1.0
 * @Since JDK1.8.0_201
 * @CreateTime 2024-06-10 22:48:18
 * @Description 移动端-商品模板信息
 * @Modification History
 * Author					History Time			Version			Description
 * -------------------------------------------------------------------------------
 * HuaAo0803@163.com	2024-06-10 22:48:18		1.0				1.0
 */
@RestController
@Api(tags = "移动端-商品模板信息")
@RequestMapping("/gateway/template")
public class GateWayTemplateController extends BaseController {
    @Resource
    private CabinetTemplateBusiness templateBusiness;

    @Resource
    private ContainerAggregateService aggregateService;

    @ApiOperation("查询模板管理列表")
    @GetMapping("/list")
    public Response<List<CabinetTemplateVO>> search(CabinetTemplateParams template) {
        List<CabinetTemplateVO> list = aggregateService.searchTemplateVOList(template);
        return ResponseHelper.successWithPage(list);
    }

    @ApiOperation("查看模板详情")
    @GetMapping("/getInfo/{templateId}")
    public Response<TemplateVO> getInfo(@PathVariable("templateId") Long templateId) {
        return ResponseHelper.success(templateBusiness.selectTemplateVOById(templateId));
    }
}